<% content_for :title, 'Clan modification' %>
<% crumbs "Edit Clan: #{@clan.name} " => edit_clan_path(@clan) %>
<div class="small-zone">
<h1>Editing clan</h1>
<% border 'border3' do %>
<% form_for(@clan) do |f| %>
  <%= f.error_messages %>
  <span class="note">The name of your clan</span>
  <p>
    <%= f.label :name %><br/>
    <%= f.text_field :name %>
  </p>
  <span class="note">The tag that your clanmates wear on their names</span>
  <p>
    <%= f.label :tag %><br />
    <%= f.text_field :tag %>
  </p>
  <span class="note">
    The clan page at <%= link_to 'savage2clans.com', 'http://savage2clans.com' %>
  </span>
  <p>
    <%= f.label :official_url %><br />
    <%= f.text_field :official_url %>
  </p>
  <span class="note">
    Your clan forums or personal site
  </span>
  <p>
    <%= f.label :sencondary_url %><br />
    <%= f.text_field :sencondary_url %>
  </p>
  <p>
    <%= f.label :color %><br />
    <%= f.text_field :color, :style => "background-color:#{@clan.color || 'white'}" %>
  </p>
  <p>
    <%= f.submit 'Update' %>
    <%= link_to 'Back', :back %>
  </p>
<% end %>
<p>
  <fieldset>
    <legend>Add a new member</legend>
    <% form_tag({:controller => :users}, {:method => :put, :id => 'recruit'}) do %>
      <%= select_tag 'id', options_for_select(User.all(:conditions => {:clan_id => nil}).collect{|u| [u.login, u.id]}),
                     :id => 'new_member' %>
      <%= hidden_field :user, :clan_id, :value => @clan.id %>
      <%= submit_tag 'Recruit!', :confirm => "Are you sure to recruit this player?",
                     :onclick => "$('recruit').action+=('/'+$('new_member').value);return($('new_member').value.length > 0);" %>
    <% end %>
  </fieldset>
</p>
<% end %>
</div>